package com.rchat.pocmini.activity.fragment.groups;

import com.aso.common.http.delegate.HttpCallbackImpl;
import com.aso.common.http.utils.HttpUtils;
import com.rchat.pocmini.global.HttpCodeGlobal;
import com.rchat.pocmini.global.RequestParam;
import com.rchat.pocmini.global.UrlsGlobal;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by itsdf07 on 2017/8/24.
 */

public class GroupsModelImpl implements GroupsContract.Model {
    @Override
    public void modifyGroupName(String groupId, String groupName, HttpCallbackImpl callback) {
        Map<String, String> param = new HashMap<>();
        param.put("groupId", groupId);
        param.put("groupName", groupName);
        //body = {"code":1222,"data":{"platform":1,"version":"1.0","enterprise":1,"groupId":"C20795","groupName":"4"}}
        String body = RequestParam.requestRootParam(HttpCodeGlobal.REQ_CODE_1222, param);
        HttpUtils.postAsyn(UrlsGlobal.getUrl(UrlsGlobal.MODIFY_GROUP_NICKNAME_URL), body, callback);
    }

    @Override
    public void requestAccountStatus(String userName, HttpCallbackImpl callback) {
        Map<String, String> param = new HashMap<>();
        param.put("userName", userName);
        //body = {"code":1232,"data":{"platform":1,"version":"1.0","enterprise":1,"userName":"111110000118"}}
        String body = RequestParam.requestRootParam(HttpCodeGlobal.REQ_CODE_1232, param);
        HttpUtils.postAsyn(UrlsGlobal.getUrl(UrlsGlobal.QUERY_ACCOUNT_DATE), body, callback);
    }
}
